/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.cvut.fel.taskpro.business.imanager;

import cz.cvut.fel.taskpro.business.support.BusinessRuleException;
import cz.cvut.fel.taskpro.data.entity.GroupTaskPro;
import cz.cvut.fel.taskpro.data.entity.Kantor;
import cz.cvut.fel.taskpro.data.entity.Student;
import cz.cvut.fel.taskpro.data.entity.Subject;
import java.util.List;
import javax.ejb.Local;
/**
 * This interface specify responsible action of business manager, which is
 * responsible for working with groups.
 * @author Tom
 * @version 1.0.0. beta
 */
@Local
public interface IGroupBusiness {
    /**
     * This method ask data layer for add new group, group must be validate first.
     * Method also ask business rule validator to validate new group, if group is in
     * incompatible state then BusinessRuleException is invoke
     * @param groupToAdd group to add to database.
     */
     public void addGroup(GroupTaskPro groupToAdd) throws BusinessRuleException;
     /**
      * This method ask data layer to find all groups which belongs to subjects and 
      * which learn specific kantor.
      * @param kantor kantor who teach groups to be found.
      * @param subjects subjects in which are groups part of.
      * @return <code>List</code> of all groups which belongs to subjects and 
      * which learn specific kantor.
      */
     public List<GroupTaskPro> getGroups(List<Subject> subjects, Kantor kantor);
     /**
      * This method ask data layer to find all groups which belongs to subject and 
      * which learn specific kantor.
      * @param kantor kantor who teach groups to be found.
      * @param subject subjects in which are founded groups part of.  
      * @return list of all groups which belongs to subjec and 
      * which learn specific kantor.
      */
     public List<GroupTaskPro> getGroups(Subject subject,Kantor kantor);
     /**
      * This method ask data layer to update subject in parameter.
      * @param subject subject to refresh from database.
      */
     public void refreshSubject(Subject subject);
     /**
      * This method ask data layer to find all groups which belongs to specific 
      * subject in parameter. The subject must pass validation. If business validator
      * find incompatible subject, then BusinessRuleException is invoke.
      * @param subject subjects in which are founded groups part of. 
      * @return list of all which belongs to specific 
      * subject
      */
     public List<GroupTaskPro> getGroups(Subject subject)throws BusinessRuleException;
     /**
      * This method ask dataLayer to update group in parameter . If studentsToRemove are specify then all assignment
      * which student have to submit are modified. If no students left, then assignment
      * will be removed. If business validator find incompatible subject, 
      * then BusinessRuleException is invoke.
      * @param updatedGroup group which will be updated and replace oldGroup
      * @param oldGroup old settings of group to validate check
      * @param studentsToRemove students who will be removed from group
      */
     public void updateGroup(GroupTaskPro oldGroup, GroupTaskPro updatedGroup,List<Student> studentsToRemove)throws BusinessRuleException;
     /**
      * This method ask dataLayer to remove group from DB. GroupToRemove must pass
      * throught validation first.If business validator
      * find incompatible subject, then BusinessRuleException is invoke.
      * @param groupToRemove group which will be removed
      */
     public void removeGroup(GroupTaskPro groupToRemove)throws BusinessRuleException;
}
